#pragma once

#include <cstdint>
#include <string>
#include <set>
#include <map>
#include "Singleton.h"
#include "struct.h"
#include "expire_def.h"


#define ST_SESSION_VAR(XX)                                                           \
  XX(std::uint32_t, uid)                                                                \
  XX(std::uint32_t, agency_id)                                                          \
  XX(std::string, agency)                                                               \
  XX(std::string, username)                                                             \
  XX(std::string, currency)                                                             \
  XX(std::int64_t, currency_unit_multi)                                                 \
  XX(std::string, currency_label) 														\
  XX(std::uint32_t, gameid)                                                               \
  XX(std::string, token)                                                                  \
  XX(std::string, hall_url)                                                               \
  XX(std::string, platform)                                                               \
  XX(std::string, fullscreen)                                                             \
  XX(std::string, lang)                                                                   \
  XX(std::string, ext)                                                             		\
  XX(std::int64_t, balance)                           
ST_STRUCT_GEN(stUserSession, ST_SESSION_VAR)

class UserSessionMgr
{
public:
    UserSessionMgr();
    virtual ~UserSessionMgr();

public:
    static UserSessionMgr* Instance()
	{
		return CSingleton<UserSessionMgr>::Instance();
	}

public:
    stUserSession* Get(std::uint32_t uid);
    stUserSession* Update(stUserSession&& user_session);

private:
    ExpireMgr<std::uint32_t, stUserSession, 5 * 60> m_mgr;  // 会话信息保留5分钟
};




